
from common.advertising import advertising
import time


class advertising_case:
    def __init__(self):
        self.m=advertising()
        self.m.login("admin","123456")

    def new_advertising(self,li): #导入表格数据，进行断言
        li_values=[]
        li1 = li[4].split("\n")
        for i in range(len(li1)):
            k = li1[i].split("=")
            li_values.append(k[1])
        wd = self.m.new_advertising(li_values[0],li_values[1],li_values[2],li_values[3],li_values[4],li_values[5],li_values[6])
        a,b="1",""
        try:
            a=wd.find_element_by_class_name("invalid-msg").text
            if a =="":
                a = "添加失败"
        except:
            b="添加成功!"

        if li[5] in a or li[5] in b :
            result = ('%s--test_case pass'%li[0])
        else:
            result = ('%s--test_case failed'%li[0])

        with open("../TestReport/GUI测试报告.xls","a+") as f:
            f.writelines(result+"\n")





